package org.de.maeyer.sampler;

import org.de.maeyer.statistic.Statistics;
import org.de.maeyer.unit.Unit;

/**
 * @author Peter De Maeyer
 */
public interface Sampler {

	String getName();

	Unit getUnit();
	
	Sampler decumulateAll();
	
	/**
	 * Atomically gets all the statistics. Because it is an atomic operation, the statistics are guaranteed to be consistent.
	 * 
	 * @return
	 */
	Statistics getStatistics();
	
	/**
	 * Atomically gest and resets the statistics. Because it is an atomic operation, it is guaranteed that the statistics have not been concurrently updated in between the get and the reset.
	 * 
	 * @return the statistics right before they were reset.
	 */
	Statistics getAndResetStatistics();

	/**
	 * Resets the sampler and all its statistics as if it was newly created.
	 */
	void reset();
}
